<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div id="app">
        <h3>测试页面占位</h3>
    </div>
</body>
<script>
    new Vue({
        el:"#app",
        template:"<h3>template提供的模板</h3>",
        // render:function(createElement) { },
        // render(h) { },
        render(createElement) { 
            // 通过 return 将构成虚拟dom节点信息返回给vue
            // 该函数只有在 返回了由 createElement 创建虚拟DOM解析对象后才能构建实例容器
            // return "测试render函数";

            // createElement(标签名,[标签的属性和功能],[标签内容和子节点])
            // return createElement("h3","render函数创建的H3标签:"+this.msg);
            // 等效于页面中       <h3>render函数创建的H3标签:{{ msg }}</h3>
            let self = this;
            return createElement("div",[
                "render函数的标签",
                createElement("p","vue仓库的msg变量:"+self.msg),
                createElement("input",{
                    attrs:{
                        type:"text"
                    },
                    domProps: {
                        value: self.msg
                    },
                    on: {
                        input: function (event) {
                            self.msg = event.target.value;
                        }
                    }
                })
            ]);
        },
        data:{
            msg:"测试变量"
        }
    })
</script>
</html>